package edu.xhu.mycat;

//import edu.xhu.mycat.service.ApUserService;

import edu.xhu.api.id.IdClient;
import edu.xhu.model.video.pojos.BiliMainChannel;
import edu.xhu.mycat.mapper.BiliUserMapper;
import edu.xhu.mycat.mapper.MainChannelMapper;
import edu.xhu.mycat.service.ChannelService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import edu.xhu.model.biliuser.pojos.BiliUser;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class MyCatTest1 {
//    @Autowired
//    private ApUserService apUserService;
    @Autowired
    MainChannelMapper mainChannelMapper;
    @Autowired
    BiliUserMapper biliUserMapper;

    @Resource
    IdClient idClient;

    @Test
    public void insertDemo() throws Exception {
        List<String> mainChannelName= Arrays.asList("番剧","国创","综艺","动画","鬼畜","舞蹈","娱乐","科技","美食","电影",
                "电视剧","纪录片", "游戏","音乐","影视","知识","资讯","生活","动物圈","虚拟UP主","汽车",
                "VLOG","公益", "时尚","搞笑","公开课","运动","单机游戏");
        List<String> describe= Arrays.asList("番剧","国创","综艺","动画","鬼畜","舞蹈","娱乐","科技","美食","电影",
                "电视剧","纪录片", "游戏","音乐","影视","知识","资讯","生活","动物圈","虚拟UP主","汽车",
                "VLOG","公益", "时尚","搞笑","公开课","运动","单机游戏");

        List<String> mainChannelTag= Arrays.asList("连载动画,新番时间表,完结动画,番剧索引,资讯,官方延伸",
                "国产动画,资讯,国产原创相关,新番时间表,布袋戏,国产动画索引,动态漫·广播剧",
                "综艺",
                "MAD·AMV,手办·模玩,MMD·3D,特摄,短片·手书，动漫杂谈,配音,综合",
                "鬼畜调教,教程演示,音MAD,人力VOCALOID,鬼畜剧场",
                "宅舞,颜值·网红舞,街舞,舞蹈综合,明星舞蹈,舞蹈教程,国风舞蹈",
                "娱乐杂谈,CP安利,颜值安利,娱乐资讯,明星综合,综艺,娱乐粉丝创作",
                "数码,极客DIY,软件应用,计算机技术,科工机械",
                "美食制作,美食记录,美食侦探,美食测评,田园美食",
                "电影",
                "电视剧",
                "纪录片",
                "单机游戏,桌游棋牌,游戏赛事,电子竟技,GMV,手机游戏,音游,网络游戏,Mugen",
                "原创音乐,乐评盘点,AI音乐,说唱,音乐现场,翻唱,演秦,VOCALOID·UTAU,电台,MV,音乐粉丝饭拍,音乐教学,音乐综台",
                "影视杂谈,影视剪辑,影视整活,AI影像,预告·资讯,小剧场,短片,影视综合",
                "科学科普,社科·法律·心理,人文历史,财经商业,校园学习,职业职场,设计·创意,野生技能协会",
                "热点,环球,社会,综台",
                "搞笑,亲子,出行,三农,家居房产,手工,绘画,日常",
                "喵星人,汪星人,动物二创,动物综合,小宠异宠,野生动物",
                "虚拟UP主",
                "汽车",
                "VLOG",
                "公益",
                "时尚",
                "搞笑",
                "公开课",
                "运动",
                "单机游戏");

        for (int i = 0; i < mainChannelTag.size(); i++) {
            BiliMainChannel biliMainChannel=BiliMainChannel.builder()
                    .mainChannelId((Long)idClient.getSnowflakeDistributedId().getData())
                    .mainChannelName(mainChannelName.get(i))
                    .describe(describe.get(i))
                    .mainChannelTag(mainChannelTag.get(i)).build();
            boolean success = mainChannelMapper.save(biliMainChannel);
            if (success) {
                System.out.println("插入成功");
            } else {
                System.out.println("插入失败");
            }
        }
    }

    @Test
    public void deleteApUserById() {
//        // 创建 LambdaQueryWrapper
//        LambdaQueryWrapper<BiliUser> queryWrapper = new LambdaQueryWrapper<>();
//        // 设置查询条件，例如根据 id 删除
//        queryWrapper.eq(BiliUser::getId, 7);
//        // 调用 delete 方法删除符合条件的记录
//        apUserService.remove(queryWrapper);
    }

    //mycat高并发读写分离测试，验证主从延迟
    @Test
    public void MStest() {
        
    }
}
